<?php
class Default_Model_DbTable_Hotel extends Zend_Db_Table_Abstract
{
	protected $_name="hae_hotel";
	protected $_primary="id";
	protected $_sequence=true;
	
	public function getallhotel($lang,$countryId,$cityId,$regionId,$spotId,$rate,$meeting,$page) {
		$select = $this->select();
		$select->from($this->_name,array('id','name','address','website','desc_'.$lang.' AS des','rate','image'));
		if ($countryId!=0)
			$select->where('countryId = '.$countryId);
		if ($cityId!=0)
			$select->where('cityId = '.$cityId);
		if ($regionId!=0)
			$select->where('regionId = '.$regionId);
		if ($spotId!=0)
			$select->where('spot LIKE  "%'.$spotId.'%"');
		if ($meeting!=0)
			$select->order('rate') ;
		if ($meeting!=0)
			$select->order('rate') ;
		
		$itemsPerPage =8;
		$hotel = new Zend_Paginator_Adapter_DbSelect($select);
		$hotels = new Zend_Paginator($hotel);
		$hotels->setCurrentPageNumber($page);
		$hotels->setItemCountPerPage($itemsPerPage);
		return $hotels;
		
	}
}
?>